pattern in java using for loop